package Tools
{
	public class ArrayTool
	{
		public function ArrayTool()
		{
			super();
		}
		
		public static function equal(arr1:Array,arr2:Array):Boolean
		{
			if(arr1==arr2)return true;
			
			if(arr1==null||arr2==null)return false;
			
			if(arr1.length!=arr2.length)return false;
			
			var index:int=0;
			while(index<arr1.length)
			{
				if(arr1[index]!==arr2[index])
				{
					return false;
				}
				index++;
			}
			
			return true;
		}
		
		public static function clone(arr:Array):Array
		{
			var newArr:Array=new Array();
			
			var index:int=0;
			while(index<arr.length)
			{
				newArr[index]=arr[index];
				index++;
			}
			
			return newArr;
		}
		
		public static function swap(arr:Array,swap1:Array,swap2:Array):void
		{
			var index:int=0;
			while(index<swap1.length)
			{
				var temp:Object=arr[swap1[index]];
				arr[swap1[index]]=arr[swap2[index]];
				arr[swap2[index]]=temp;
				index++;
			}
		}
	}
}